﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using MVCGenerator;

/* Generated with http://xmltocs.com/ */
namespace EDMXParserV1
{
    public class NavigationProperty
    {
        public String Name { get; set; }
        public String Relationship { get; set; }
        public String FromRole { get; set; }
        public String ToRole { get; set; }
        public EntityType FromEntityType { get; set; }
        public EntityType ToEntityType { get; set; }

        public AssociationSet AssociationSet { get; set; }

        public Association Association { get; set; }

        public static NavigationProperty New(System.Xml.XmlNode Node)
        {
            NavigationProperty NavigationProperty = new NavigationProperty();

            foreach (XmlAttribute Attribute in Node.Attributes)
            {
                switch (Attribute.Name)
                {
                    case "Name":
                        NavigationProperty.Name = Attribute.Value;
                        break;
                    case "Relationship":
                        NavigationProperty.Relationship = Attribute.Value;
                        break;
                    case "FromRole":
                        NavigationProperty.FromRole = Attribute.Value;
                        break;
                    case "ToRole":
                        NavigationProperty.ToRole = Attribute.Value;
                        break;
                    default:
                        Globals.AttributeSwitchCoder(Attribute);
                        break;
                }
            }

            foreach (XmlNode ChildNode in Node.ChildNodes)
            {
                switch (ChildNode.Name)
                {
                    default:
                        Globals.NodeSwitchCoder(ChildNode);
                        break;
                }
            }

            return NavigationProperty;
        }

    }
}
